import random

import requests

# sign_01
env = "http://192.168.1.125:8088"
url = env + "/futureloan/mvc/api/member/register"

# 前三位
list = ["186", "185", "176", "175", "166", "156", "155", "146", "145", "132", "131", "130",
        "134", "135", "136", "137", "138", "139", "144", "147", "148", "150", "151", "152", "157", "158", "159", "172",
        "178", "182", "183", "184", "187", "188", "198",
        "133", "141", "149", "153", "173", "177", "180", "181", "189", "191", "199"]
for i in list:
    num = []
    s = random.randint(10000000, 99999999)
    tel = i + str(s)
    sc = {"mobilephone": tel, "pwd": "123546", "regname": ""}
    r = requests.get(url, params=sc)
    try:
        assert r.json()['status'] == 1, '注册成功断言失败%s%s' % (sc, r.text)
    except Exception as e:
        print(e)

# list = [{"mobilephone": "110", "pwd": "123546", "regname": ""},
#         {"mobilephone": "13333333333", "pwd": "123546", "regname": ""},
#         {"mobilephone": "", "pwd": "123546", "regname": ""},
#         {"mobilephone": "13571504808", "pwd": "", "regname": ""},
#         {"mobilephone": "13570504808", "pwd": "12346", "regname": ""},
#         {"mobilephone": "13570504808", "pwd": "1234567890123456789", "regname": ""},
#         {"mobilephone": "13570504808", "pwd": "123546", "regname": ""},
#         {"mobilephone": "15619406969", "pwd": "123546", "regname": "asdf"}]
# for i in list:
#     r = requests.get(url, params=i)
#     print(r.json())


'''
测试发现的缺陷
    1.一些合法的手机号注册失败,比如199、191
    2.密码可以包含空格、中文字符等，与常识不符。
    3.手机号正确，密码正确时,用户名超长，报错”服务器异常”，要么提示错误，要么注册成功。
    4.手机号错误,密码正确时，提示手机号不正确
    手机号正确,密码错误时，提示密码不正确
    手机号错误,密码错误时，提示密码不正确。应该提示手机号错误。
    一致性的问题。
'''
